FROM mysql:5.7

ARG MYSQL_ROOT_PASSWORD
ARG MYSQL_USER
ARG MYSQL_PASSWORD
ARG MYSQL_CHARSET
ARG MYSQL_COLLATION
ARG MYSQL_DATABASE

ENV MYSQL_ROOT_PASSWORD ${MYSQL_ROOT_PASSWORD:-root}
ENV MYSQL_USER ${MYSQL_USER:-user}
ENV MYSQL_PASSWORD ${MYSQL_PASSWORD:-user}
ENV MYSQL_CHARSET ${MYSQL_CHARSET:-utf8}
ENV MYSQL_COLLATION ${MYSQL_COLLATION:-utf8_bin}
ENV MYSQL_DATABASE ${MYSQL_DATABASE:-student}

ENV LANGUAGE  "zh_CN.UTF-8"
ENV LANG  "zh_CN.UTF-8"
ENV LC_CTYPE "zh_CN.UTF-8"

COPY data.sql /docker-entrypoint-initdb.d/

VOLUME ["/var/lib/mysql"]

COPY docker-entrypoint.sh /usr/local/bin/
 
ENTRYPOINT ["docker-entrypoint.sh"]

EXPOSE 3306

CMD ["mysqld"]

